import axios from "axios";


// 创建axios实例并配置
const request = axios.create({
    // baseURL: 'http://ums.tangxiaoyang.vip/api',
    baseURL: '/api',
    timeout: 5000
})

/**
 * 请求拦截器
 */
request.interceptors.request.use(config => {
    // 设置请求头为JSON格式 
    config.headers['Content-Type'] = 'application/json;charset=UTF-8'

    // 添加token
    var token = 'asdf23423fsdaf234234'
    config.headers['token'] = token

    return config
})



/**
 * 响应拦截器
 */
request.interceptors.response.use(response => {
    return response.data
})


export default request